package org.wheel.plugins.toolkit.sql.plugin;

import java.util.ServiceLoader;

/**
 * 函数插件工厂 – SPI 加载
 */
public final class FunctionFactory {

    private static final ServiceLoader<FunctionPlugin> LOADER =
            ServiceLoader.load(FunctionPlugin.class);

    public static FunctionPlugin get(String name) {
        for (FunctionPlugin p : LOADER) {
            if (p.name().equals(name)) return p;
        }
        throw new IllegalArgumentException("未注册函数插件: " + name);
    }
}